package com.ys.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @ClassName WebConfig
 * @Author 1628994918qq.com
 * @Date 2023/2/28 20:50
 *
 * 设置URL白名单和黑名单
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Resource
    private JWTInterceptor JWTInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(JWTInterceptor)
                //需要拦截的路径
                .addPathPatterns("/test/**")
                //不需要拦截的路径
                .excludePathPatterns("/login");
    }
}
